#ifndef COMPILETARGETBASE_H
#define COMPILETARGETBASE_H

#include "compileoptionsbase.h"

enum OptionsRelationType {
  ortCompilerOptions = 0,
  ortLinkerOptions,
  ortIncludeDirs,
  ortLibDirs,
  ortResDirs,
  ortLast
};

enum OptionsRelation {
  orUseParentOptionsOnly = 0,
  orUseTargetOptionsOnly,
  orPrependToParentOptions,
  orAppendToParentOptions
};


enum TargetType {
  ttExecutable    = 0,
  ttConsoleOnly   = 1,
  ttStaticLib     = 2,
  ttDynamicLib    = 3,
  ttCommandsOnly  = 4,
  ttNative        = 5
};

enum MakeCommand {
  mcClean = 0,
  mcDistClean,
  mcBuild,
  mcCompileFile,
  mcAskRebuildNeeded,
  mcSilentBuild,
  mcLast
};


enum TargetFilenameGenerationPolicy {
  tgfpPlatformDefault = 0,
  tgfpNone
};

class CompileTargetBase : public CompileOptionsBase {
  public:
    CompileTargetBase();
    virtual ~CompileTargetBase();
    virtual void SetTargetFilenameGenerationPolicy( TargetFilenameGenerationPolicy prefix,
        TargetFilenameGenerationPolicy extension );
    virtual void GetTargetFilenameGenerationPolicy( TargetFilenameGenerationPolicy& prefixOut,
        TargetFilenameGenerationPolicy& extensionOut ) const;
    virtual const wxString& GetFilename() const;
    virtual const wxString& GetTitle() const;
    virtual void SetTitle( const wxString& title );
    virtual void SetOutputFilename( const wxString& filename );
    virtual void SetImportLibraryFilename( const wxString& filename );
    virtual void SetDefinitionFileFilename( const wxString& filename );
    virtual void SetWorkingDir( const wxString& dirname );
    virtual void SetObjectOutput( const wxString& dirname );
    virtual void SetDepsOutput( const wxString& dirname );
    virtual OptionsRelation GetOptionRelation( OptionsRelationType type ) const;
    virtual void SetOptionRelation( OptionsRelationType type, OptionsRelation rel );
    virtual wxString GetWorkingDir();
    virtual wxString GetObjectOutput() const;
    virtual wxString GetDepsOutput() const;
    virtual wxString GetOutputFilename();
    virtual wxString SuggestOutputFilename();
    virtual wxString GetExecutableFilename() const;
    virtual wxString GetDynamicLibFilename();
    virtual wxString GetDynamicLibImportFilename();
    virtual wxString GetDynamicLibDefFilename();
    virtual wxString GetStaticLibFilename();
    virtual wxString GetNativeFilename();
    virtual wxString GetBasePath() const;
    virtual void SetTargetType( TargetType pt );
    virtual TargetType GetTargetType() const;
    virtual const wxString& GetExecutionParameters() const;
    virtual void SetExecutionParameters( const wxString& params );
    virtual const wxString& GetHostApplication() const;
    virtual void SetHostApplication( const wxString& app );
    virtual bool GetRunHostApplicationInTerminal() const;
    virtual void SetRunHostApplicationInTerminal( bool in_terminal );
    virtual void SetCompilerID( const wxString& id );
    virtual const wxString& GetCompilerID() const { return m_CompilerId; }
    virtual wxString GetMakeCommandFor( MakeCommand cmd ) const { return m_MakeCommands[cmd]; }
    virtual void SetMakeCommandFor( MakeCommand cmd, const wxString& make );
    virtual bool MakeCommandsModified() const { return m_MakeCommandsModified; }
  protected:
    friend class M_Code_Project;
    wxString m_Filename;
    wxString m_Title;
    mutable wxString m_OutputFilename;
    wxString m_ImportLibraryFilename;
    wxString m_DefinitionFileFilename;
    wxString m_WorkingDir;
    wxString m_ObjectOutput;
    wxString m_DepsOutput;
    wxString m_ExecutionParameters;
    wxString m_HostApplication;
    OptionsRelation m_OptionsRelation[ortLast];
    TargetType m_TargetType;
    wxString m_CompilerId;
    wxString m_MakeCommands[mcLast];
    bool m_MakeCommandsModified;
    bool m_RunHostApplicationInTerminal;
    TargetFilenameGenerationPolicy m_PrefixGenerationPolicy;
    TargetFilenameGenerationPolicy m_ExtensionGenerationPolicy;
  private:
    void GenerateTargetFilename( wxString& filename ) const;
};

#endif
